Try to make sure that we have some focused widget on map. (#50339)
authorOwen Taylor <otaylor@redhat.com>
Thu, 31 Jan 2002 16:13:12 +0000 (16:13 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 31 Jan 2002 16:13:12 +0000 (16:13 +0000)
Wed Jan 30 13:55:59 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkwindow.c (gtk_window_show): Try to make
        sure that we have some focused widget on map. (#50339)

        * gtk/gtkdialog.c (gtk_dialog_map): Handling picking
        a focus widget here differently so that if a
        response button gets picked, it's the default one.

        * tests/testgtk.c (make_message_dialog): Set the
        default response for the dialogs.

tests/testgtk.c

index 1a87cd4d526879df26b55b57127d0cc85ec6a6a1..667eef04424170fd3a05ea65ccbf0324c4fcdf18 100644 (file)
@@ -3570,7 +3570,8 @@ create_modal_window (void)
 static void
 make_message_dialog (GtkWidget **dialog,
                      GtkMessageType  type,
-                     GtkButtonsType  buttons)
+                     GtkButtonsType  buttons,
+                    guint           default_response)
 {
   if (*dialog)
     {
@@ -3591,7 +3592,9 @@ make_message_dialog (GtkWidget **dialog,
                       "destroy",
                       GTK_SIGNAL_FUNC (gtk_widget_destroyed),
                       dialog);
-  
+
+  gtk_dialog_set_default_response (GTK_DIALOG (*dialog), default_response);
+
   gtk_widget_show (*dialog);
 }
 
@@ -3603,10 +3606,10 @@ create_message_dialog (void)
   static GtkWidget *error = NULL;
   static GtkWidget *question = NULL;
 
-  make_message_dialog (&info, GTK_MESSAGE_INFO, GTK_BUTTONS_OK);
-  make_message_dialog (&warning, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE);
-  make_message_dialog (&error, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK_CANCEL);
-  make_message_dialog (&question, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO);
+  make_message_dialog (&info, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, GTK_RESPONSE_OK);
+  make_message_dialog (&warning, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, GTK_RESPONSE_OK);
+  make_message_dialog (&error, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK_CANCEL, GTK_RESPONSE_OK);
+  make_message_dialog (&question, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, GTK_RESPONSE_YES);
 }
 
 /*